home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
s-gikan2.maizuru-ct.ac.jp
/
s-gikan2.maizuru-ct.ac.jp.zip
/
s-gikan2.maizuru-ct.ac.jp
/
pub
/
ncvc352a_install.exe
/
{app}
/
scripts
/
change_for_laser.pl
< prev
next >
Wrap
Perl Script
|
2012-10-11
|
2KB
|
63 lines
#! /usr/bin/perl
# NCVCé┼Åoù═é╡é╜NCâRü[âhé≡âîü[âUü[ë┴ìHï@ùpé╔ò╧è╖é╖éΘâXâNâèâvâg #
# G01é┼ZÄ▓â}âCâiâXò√îⁿé╔É╪éΦì₧é▐âRü[âhé≡$ON_CodeüA #
# G00é▄é╜é═G01é┼ZÄ▓âvâëâXò√îⁿé╔æ╥ö≡é╖éΘâRü[âhé≡$OFF_Code #
# é╔ò╧è╖é╖éΘ #
# G90é╠âRü[âhé╠é▌æ╬ë₧ #
# Ägéóò√é╠âRâc #
# (1)NCÉ╢ɼâIâvâVâçâôé╠É╪ìφî┤ô_(G92)é╠ZÆlé╞Rô_é≡ #
# É│(âvâëâX)é╠ô»é╢Ælé╔é╖éΘ(ù╝ò√â[âìé┼éαénéj) #
# (2)É╪éΦì₧é▌é≡â}âCâiâXÆlé╔é╖éΘ #
# (3)òWÅÇâJâXâ^âÇâwâbâ_ü[é≡âîü[âUùpé╔âJâXâ^âÇ #
# {G90orG91}G54{G92_Initial} ü¿ {G90orG91}G92{G92X}{G92Y} #
# {Spindle}M3 ü¿ ìφÅ£ #
# é▒é╠É╪ìφÅ≡îÅé┼É╢ɼé╡é╜NCâRü[âhé≡üAé▒é╠âXâNâèâvâgé┼ò╧è╖é╖éΘé╞ #
# ZÆlé╠Åπë║é╔ìçéφé╣é─âîü[âUÅoù═é╠ON/OFFé¬ÉºîΣé┼é½é▄é╖ #
#######################
#âîü[âUü[é≡âIâôé╔é╖éΘâRü[âh
$ON_Code = 'M03';
#âîü[âUü[é≡âIâté╔é╖éΘâRü[âh
$OFF_Code = 'M05';
#######################
$pre_file= $ARGV[0];
$out_file= $ARGV[1];
open(IN,$pre_file);
open(OUT,">$out_file");
$G0X = -1;
$Zn=1000;
$Zp=1000;
while(<IN>){
if(!/^N?[0-9\s]*[\(\%]/){
if(/G0*?([0123])[A-Z\s]/){ $G0X= $1; }
if($G0X != -1){
if(/Z([0-9\-\.]+)/){ $Zn = $1; }
}
if($G0X == 1 && $Zn < $Zp){
$_ = $ON_Code . "\nG01";
$Zp = $Zn;
}
elsif(($G0X == 0 or $G0X == 1) && $Zn > $Zp){
$_ = $OFF_Code . "\nG0" . $G0X;
$Zp = $Zn;
}
}
print OUT;
}